Skip to content

Xy screen variables - #48

Merged
roussel-ryan merged 5 commits into
mainfrom
xy-variables
Jul 14, 2026
Merged

Xy screen variables#48
roussel-ryan merged 5 commits into
mainfrom
xy-variables

Conversation

@roussel-ryan

Copy link
Copy Markdown
Collaborator

This pull request introduces support for screen centroid readback variables (X and Y) in the virtual accelerator, aligning screen PVs with BPMs and updating both implementation and tests to ensure coverage and consistency. The main changes include new variable classes for screen centroids, updates to variable mappings, and consolidation of test PV attribute lists.

Screen centroid variable support:

  • Added ScreenCentroidVariable, ScreenXVariable, and ScreenYVariable classes to provide read-only access to the beam centroid positions for screens, with automatic conversion to millimeters. (virtual_accelerator/cheetah/actions.py)
  • Updated get_screen_variables to include BPMXVariable and BPMYVariable for screen elements, enabling exposure of X and Y PVs. (virtual_accelerator/bmad/variables.py)

Variable mapping updates:

  • Changed the screen variable mapping so that the "X" and "Y" PVs now use the new ScreenXVariable and ScreenYVariable classes, replacing the old array size mappings. (virtual_accelerator/cheetah/variables.py)

Test improvements and refactoring:

  • Centralized default PV attribute lists for magnets, screens, and BPMs, and updated all relevant test functions to use these constants for improved maintainability and coverage. (virtual_accelerator/tests/_bmad_model_test_utils.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Updated and added tests in test_cu_hxr.py to validate the new screen PVs and ensure that screen PV coverage matches expectations. (virtual_accelerator/tests/test_cu_hxr.py) [1] [2] [3] [4]

Dependency update:

  • Imported the Screen class in cheetah/actions.py to support type checking for the new screen centroid variables. (virtual_accelerator/cheetah/actions.py)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for screen centroid readback PVs (X, Y) so screen devices expose centroid readbacks consistently (similar to BPMs), and updates the test utilities/tests to validate the expanded screen PV coverage.

Changes:

  • Added Cheetah action variables for screen centroid readbacks (ScreenXVariable, ScreenYVariable) and wired them into the screen PV mapping.
  • Updated BMAD screen variable generation to include :X/:Y PVs for screen elements.
  • Refactored test utilities to centralize default PV suffix lists and updated CU HXR tests to use the consolidated helpers.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
virtual_accelerator/cheetah/actions.py Adds read-only centroid variables for screens (X/Y) with unit conversion.
virtual_accelerator/cheetah/variables.py Updates the screen PV suffix → variable-class mapping to route X/Y to the new centroid variables.
virtual_accelerator/bmad/variables.py Extends BMAD screen variables to expose :X/:Y readbacks.
virtual_accelerator/tests/_bmad_model_test_utils.py Centralizes default PV attribute lists and updates screen/BPM/magnet helper defaults accordingly.
virtual_accelerator/tests/test_cu_hxr.py Updates CU HXR tests to use the renamed/updated screen PV coverage helpers and adjusts expected supported-variable count.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread virtual_accelerator/cheetah/actions.py
Comment thread virtual_accelerator/cheetah/actions.py
Comment thread virtual_accelerator/tests/test_cu_hxr.py Outdated
Comment thread virtual_accelerator/tests/_bmad_model_test_utils.py
roussel-ryan and others added 2 commits July 14, 2026 12:24
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@roussel-ryan
roussel-ryan merged commit 6b2cf06 into main Jul 14, 2026
20 checks passed
@roussel-ryan
roussel-ryan deleted the xy-variables branch July 14, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants